package cn.yangliu.task.handler;

import cn.yangliu.task.entity.TaskVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;

/**
 * @author 杨柳
 * @date 2019-04-09
 */
public class TaskPublisher {

    @Autowired
    private RedisTemplate redisTemplate;

    public static final String PUBLISH_TYPE_CANCLE = "cancle_task";
    public static final String PUBLISH_TYPE_CREATE = "create_task";
    public static final String PUBLISH_TYPE_RESTART= "restart_task";

    public void sendMessage(String channel, TaskVo taskVo) {
        redisTemplate.convertAndSend(channel, taskVo);
    }

}
